

export interface ResponsrData {
    code: number
    message: string,
    ok: boolean
}
// 用户数据类型
export interface UserData {
    _id: string,
    username: string,
    avatar: string,
    selected?: boolean //是否被选中
    isFriend?:boolean
    roomName?:string
}
// 登录接口返回的数据类型
export interface reqLoginData extends ResponsrData {
    data: {
        token: string
        _id: string,
        username: string,
        avatar: string,
    }
}

// 好友数据类型
export type friendsData = UserData[]
// 获取全部好友信息接口返回数据的类型
export interface ReqfriendsData extends ResponsrData {
    data: friendsData
}
// 消息数据类型
export interface chatData {
    // 构建消息对象
    _id?: string,
    senderId: string | null,
    receiverId: string,
    content: string,
    timestamp: string|Date
    isRead?: boolean// 新增字段，表示消息是否已读
    __v?: number
};
// 最后一条信息和未读条数
export interface chatLast {
    isRead: boolean,
    lastMessage: string,
    receiverId: string,
    receiverName: string,
    senderId: string,
    senderName: string,
    timestamp: string,
    _id: string,
    senderAvatar: string, // 获取发送者的头像
    receiverAvatar: string  // 获取接收者的头像
    unreadCount?: number
    selected?: boolean //是否被选中

}
// 好友申请信息类型
export interface newfriend {
    _id: string,
    username: string,
    avatar: string,
    status: string
}
export interface newfriends extends ResponsrData{
    data:newfriend[]
}